package com.example.demo_dongruanD.service.impl;


import com.example.demo_dongruanD.pojo.Doctor;
import com.example.demo_dongruanD.repository.DoctorRepository;
import com.example.demo_dongruanD.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class DoctorServiceImpl implements DoctorService {

    private final DoctorRepository doctorRepository;

    @Autowired
    public DoctorServiceImpl(DoctorRepository doctorRepository) {
        this.doctorRepository = doctorRepository;
    }

    @Override
    public Doctor findByPhone(String phone) {
        return doctorRepository.findByPhone(phone).orElse(null);
    }
}
